

<div class="content">
<form method="post" action="<?=n_url('regSave')?>">
<?php
if(!empty($data['pbox'])){
?>
	<?php
	foreach($data['pbox'] as $key=>$val){
	?>
	<a class="pboxItem" id="pboxItem-<?=$val['pevent']?>" href="javascript:void(0)" style="text-align:center;border:1px solid #789abc;margin:10px;padding:4px;display: inline-block">
		<img width="80" src="<?=n_img('skin','m2/pic48x48.gif')?>" /><br />
		<input type="checkbox" name="pcode[]" value="<?=$val['pevent']?>" />
		<?=$val['pname']?>
	</a>
	<?php
	}
	?>
<?php
}

?>
<br />
<input type="hidden" name="site" value="<?=$data['site']?>" />
<input type="submit" />
</form>


<script>

<?php
$reged = array();
if(!empty($data['reged'])){
	foreach($data['reged'] as $key=>$val){
		$reged[] = $val['pevent'];
	}
}
echo "var reged = ".json_encode($reged).";";
?>

$(document).ready(function(){
	for(pcode in reged){
		$('#pboxItem-'+reged[pcode]+' input:checkbox').attr('checked',true);
	}
	$('.pboxItem').click(function(){
		if('checked'==$(this).find('input:checkbox').attr('checked')){
			$(this).find('input:checkbox').removeAttr('checked')
		}else{
			$(this).find('input:checkbox').attr('checked',true)
		}
		
	});
});
</script>
</div>